home *** CD-ROM | disk | FTP | other *** search
/ Young Minds / Young Minds Interactive CD-ROM.ISO / crystal / cvdie.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-01-12  |  2.8 KB  |  82 lines

  1. /* cvdie.c
  2.  ************************************************************************/
  3.  
  4. #include <stdio.h>
  5. #include    <string.h>
  6. #include    "cvobj.h"
  7. #include    "cvorcs.h"
  8. #include    "cvocab.h"
  9. #include    "cvlocs.h"
  10. #include    "cvmisc.h"
  11.  
  12. /* "You're dead, Jim."  You got yourself killed somehow, clown.  The
  13.  * easiest way is to go to location DEAD, which is the destination of
  14.  * some entries in travel structures.  We allow this 'maxdie' times,
  15.  * where maxdie is automatically initialized based on the number of
  16.  * snide messages we have available (and how much orange smoke...) in
  17.  * messages around rmsg[81].  Each death results in a message (81,83,...)
  18.  * which offers reincarnation; if accepted, this results in message 82, 84,
  19.  * etc.  The last time, if he wants another chance, he gets a snide
  20.  * remark (what else? so what's new?) as we exit.  When reincarnated,
  21.  * all objects being carried get moved to 'oldlc2' (presumably the last
  22.  * place prior to getting killed) without change of prop number.  The lamp
  23.  * is turned off and left outside the building (only if he was carrying
  24.  * it, of course).  He himself is left outside the privy (and heaven help
  25.  * him if he tries to "hope" back into the cave without the lamp!).
  26.  *
  27.  * 'oldlc2' is zapped so he can't just "retreat".
  28.  */
  29.  
  30. void
  31. die()
  32. {
  33.     register int yea;
  34.     register struct cvobj *curobj ;
  35.  
  36.     blklin = TRUE ;
  37.     if ( (UNICRN->conn1.where == oldlc2)
  38.         && (loc == oldlc2)
  39.         && (UNICRN->prop) ) {
  40.         pspeak(UNICRN,5); /* very lucky! */
  41.         UNICRN->prop = 1 ;
  42.         loc = oldlc2;
  43.     } else {
  44.         if (closing || demo) {
  45.             rspeak(131);
  46.             ++numdie;
  47.             finish = TRUE;
  48.             return ;
  49.         }
  50.         yea = yes(81+numdie*2,82+numdie*2,54) ;
  51.         ++numdie;
  52.         if ((numdie == maxdie) || !yea) {finish = TRUE; return; }
  53.         if (TOTING(LAMP)) {
  54.             move(LAMP,LAMPLOC);
  55.             LAMP->prop = 0 ;
  56.         }
  57.         loc = LAMPLOC;
  58.         move(COMPASS,LAMPLOC);
  59.             /* the following may be confusing. GIANT and PRIEST
  60.              * represent the same thing to the adventurer, but
  61.              * here they are represented by an 'object' and a
  62.              * 'monster'.
  63.              */
  64.         if ((GIANT->prop == 1) && PRIEST->dseen) destry(GIANT);
  65.     } /* may or may not be dead; objects still get dropped */
  66.     /* drop all objects (still) being carried.
  67.         Throw away if over water. */
  68.     newloc = (oldlc2->flags & DROWN) ? LOST : oldlc2 ;
  69.     for (curobj = cvobj; curobj->desc != NULL; ++curobj)
  70.         if (TOTING(curobj)) move(curobj,newloc); /* drop them */
  71.     if (RUG->prop == 1) RUG->prop = 0 ; /* get off the rug */
  72.     if ((BOAT->prop/2) == 1) BOAT->prop -= 2; /* leave the boat */
  73.     if ( ( LNUM(SCROLL->conn1.where) == 91)
  74.         || INMAZE(SCROLL->conn1.where))
  75.         move(SCROLL,&(cvloc[SCROLL->iloc]));
  76.     if ( (LNUM(MEDAL->conn1.where) == CAPE->iloc)
  77.         || (LNUM(MEDAL->conn1.where) == SPICE->iloc) )
  78.         move(MEDAL,&(cvloc[MEDAL->iloc]));
  79.     if (SKELTN->prop == 1) SKELTN->prop = 2;
  80.     newloc = oldloc = loc ;
  81. }
  82.